#ifndef _CODEC_H264_H_
#define _CODEC_H264_H_

#include <libavcodec/avcodec.h>
 
#define INBUF_SIZE 4096   //接受区域大小
struct ffmpeg_player
{
    AVCodecContext *codec_ctx;
    AVCodec *codec;
    AVCodecParserContext *coder_parser_ctx;
    struct SwsContext *swc_context;
    AVFrame *what_frame;
    AVPacket pkt;

    /* extra buffers */
    unsigned char *frame_fmt;
};

enum what_codec
{
    FFMPEG_ENCODER,
    FFMPEG_DECODER
};

FILE* pFin;
FILE* pFout;

#define INBUF_SIZE 4096

void test_codec_h264_decoder_app_main(const char **argv);

void test_codec_h264_encoder_app_main(const char **argv);

int codec_h264_init_ffmpeg_player(struct ffmpeg_player *player, int codec_id);

void codec_h264_deinit_ffmpeg_player(struct ffmpeg_player *player);

int codec_h264_decode_one_frame(struct ffmpeg_player *player, unsigned char *raw_data, int raw_data_len, int timeout_cnt);

int codec_h264_config_encodec_player(struct ffmpeg_player *player, int width, int height, int fps, int raw_format);

int codec_h264_config_decoder_player(struct ffmpeg_player *player);

#endif /* _CODEC_H264_H_ */